<template>
	<view>
        <web-view :webview-styles="webviewStyles" :src="url"></web-view>
    </view>
</template>
<script>
	import {common} from '@/common/publish.js';
	export default {
		data() {
			return {
				webviewStyles: {
                    progress: {
                        color: '#FF3333'
                    }
                },
				url:''
			};
		},
		onLoad(event) {
			if(event.type =='proj'){
				this.url = 'http://nbnet.chinaecdc.com/api/proForm.htm?'+ event.id;
			}else if(event.type == 'project'){
				this.getproject(event.id)
			}else if(event.type == 'projectlist'){
				this.getprojectlist(event.id)
			}else{
				this.url = event.url
			}
			//console.log(this.url);
		},
		methods: {
			getproject:function(id){
				uni.request({
					url: common.localurl+'/api/project/project.json', 
					data:{projectId:id},
					method:'GET',
					dataType:'json',
					success: (res) => {
						this.url = res.data.data.project.link;
						console.log(this.url)
					}
				});
			},
			getprojectlist:function(id){
				uni.request({
					url: common.localurl+'/api/project/projectDynamic.json', 
					data:{projectDynamicId:id},
					method:'GET',
					dataType:'json',
					success: (res) => {
						this.url = res.data.link;
						console.log(this.url)
					}
				});
			}
		},
	}
</script>

<style>

</style>
